package com.cmy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

//自动装配,组件
@Controller
//@RequestMapping("/hello")
public class HelloController {
    //请求url映射 /hello---->hello.jsp  如果是多级,9不被注释 localhost:8080/hello/hello
    @RequestMapping("/hello")
    public String hello(Model model){
        //封装数据
        model.addAttribute("msg","Hello,SpringMVCAnnotation!");

        return "hello";//会被视图解析器处理
    }
}

    